package com.oceansoft.mobile.econsole.exam.persistence;

import com.github.pagehelper.Page;
import com.oceansoft.mobile.econsole.exam.entity.*;
import com.oceansoft.mobile.econsole.modules.base.entity.Query;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by 祝亚 on 2016/8/17.
 */
@Repository
public interface IExamMapper {
    List<ExamTest> findTestByCondition(Query query);

    void addExamTest(ExamTest examTest) throws Exception;

    void updateExamTest(ExamTest examTest)throws Exception;

    void deleteExamTest(int id)throws Exception;

    ExamTest getExamTestById(int id);

    List<Questions> findQuestionByCondition(Query query);

    /**
     * 查询考试所有题
     * @param exam
     * @return
     */
    List<Questions> findQuestionByExam(ExamTest exam);

    List<QuestionsExt> findQuestionForOneExam(ExamTest exam);

    Questions getQuestionById(int id);

    List<Option> findOptionByQuestionId(int id);

    List<Attach> findAttachByQuestionId( @Param("id")int id,@Param("type")String type);
    List<Attach> findAttachByIdNoContent( @Param("id")int id,@Param("type")String type);

    int saveQuestions(Questions questions) throws Exception;

    int saveOption(Option o) throws Exception;

    int saveAttach(Attach attach) throws Exception;

    Attach getAttachById( @Param("id")int id);

    void updateQuestionAnswer(Questions questions) throws Exception;

    void updateQuestion(Questions questions);

    List<ExamTest> findAllTest();
}
